home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -seriously_amiga- / programming / other / cyberxxxsrc / decoder / txt / decodepcm.c < prev    next >
C/C++ Source or Header  |  1999-02-08  |  2KB  |  86 lines

  1. /*
  2. sc:c/sc opt txt/DecodePCM.c
  3. */
  4.  
  5. #include "Decode.h"
  6.  
  7. struct PCMData {
  8.   ulong dummy;
  9. };
  10.  
  11. /* /// "DecodePCM8Mono()" */
  12. __asm ulong DecodePCM8Mono(REG(a0) uchar *from,
  13.                            REG(a1) uchar *toL,
  14.                            REG(a2) uchar *toR,
  15.                            REG(d0) ulong size,
  16.                            REG(a3) struct PCMData *spec)
  17. {
  18.   ulong s, sr;
  19.  
  20.   ulong *f=(ulong *)from, *t=(ulong *)toL;
  21.   sr=size;
  22.   s=(size+3)/4;
  23.   while(s--) {
  24.     *t++=(*f++)^0x80808080;
  25.   }
  26.   return sr;
  27. }
  28. /* \\\ */
  29.  
  30. /* /// "DecodePCM8Stereo()" */
  31. __asm ulong DecodePCM8Stereo(REG(a0) ushort *from,
  32.                              REG(a1) uchar *toL,
  33.                              REG(a2) uchar *toR,
  34.                              REG(d0) ulong size,
  35.                              REG(a3) struct PCMData *spec)
  36. {
  37.   ulong s, sr;
  38.   ushort d;
  39.  
  40.   s=sr=size/2;
  41.   while(s--) {
  42.     d=(from[0])^0x8080;
  43.     *toL++=(uchar)(d>>8);
  44.     *toR++=(uchar)(d);
  45.     from++;
  46.   }
  47.   return sr;
  48. }
  49. /* \\\ */
  50.  
  51. /* /// "DecodePCM16Mono()" */
  52. __asm ulong DecodePCM16Mono(REG(a0) ushort *from,
  53.                             REG(a1) short *toL,
  54.                             REG(a2) short *toR,
  55.                             REG(d0) ulong size,
  56.                             REG(a3) struct PCMData *spec)
  57. {
  58.   ulong s, sr;
  59.  
  60.   s=sr=size/2;
  61.   while(s--) {
  62.     *toL++=get16pc(from);
  63.   }
  64.   return sr;
  65. }
  66. /* \\\ */
  67.  
  68. /* /// "DecodePCM16Stereo()" */
  69. __asm ulong DecodePCM16Stereo(REG(a0) ushort *from,
  70.                               REG(a1) short *toL,
  71.                               REG(a2) short *toR,
  72.                               REG(d0) ulong size,
  73.                               REG(a3) struct PCMData *spec)
  74. {
  75.   ulong s, sr;
  76.  
  77.   s=sr=size/4;
  78.   while(s--) {
  79.     *toL++=get16pc(from);
  80.     *toR++=get16pc(from);
  81.   }
  82.   return sr;
  83. }
  84. /* \\\ */
  85.  
  86.